<template>
	<view>
		<view class="chat-body">
			<block v-for="(item,index) in chatList" :key="index">
				<view class="chat-one" v-if="!item.isMe">
					<image class="chat-face" src="@/static/imgs/nav3.png"></image>
					<view class="chat-box">
						<view class="chat-sender">客户</view>
						<view class="chat-content" v-if="item.type == 'txt'">{{item.content}}</view>
						<image class="chat-img" v-if="item.type == 'img'" :src="item.content" mode='widthFix'></image>
					</view>
				</view>
				<view class="chat-one chat-one-mime" v-else>
					<view class="chat-box">
						<view class="chat-content" v-if="item.type == 'txt'">{{item.content}}</view>
						<image class="chat-img" v-if="item.type == 'img'" :src="item.content" mode='widthFix'></image>
					</view>
					<image class="chat-face" src="@/static/imgs/nav3.png"></image>
				</view>
			</block>
		</view>
		
		<view class="chat-footer">
			<input class="msg-input" type="text" placeholder="请输入聊天内容"/>
			<image class="img-chose" src="@/static/imgs/nav2.png"></image>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				chatList: [
					{
						isMe: false,
						type: 'txt',
						content: '你好，我是客户'
					},{
						isMe: false,
						type: 'img',
						content: '/static/imgs/nav1.png'
					},{
						isMe: true,
						type: 'txt',
						content: '你好，我是me'
					},{
						isMe: true,
						type: 'img',
						content: 'static/imgs/nav2.png'
					}
				]
			}
		},
		methods: {
			
		}
	}
</script>

<style lang='scss' scope>
	.chat-face,.chat-img,.img-chose {
		width: 50px;
		height: 50px;
	}
	.chat-one-mime{
		display: flex;
		justify-content: right;
	}
	.chat-one {
		display: flex;
	}
	.chat-footer {
		display: flex;
		align-items: center;
	}
	.chat-footer {
		margin-bottom: 0;
		padding-bottom: 0;
		.chat-box {
			border: solid 1px
		}
	}
</style>
